import 'package:flutter_base_app/utils/user/user_help.dart';

import '../../generated/json/base/json_field.dart';
import '../../generated/json/user_data.g.dart';

@JsonSerializable()
class UserData {
  String userId = "";
  String userName = "";
  String email = "";
  String token = "";
  String refreshToken = "";
  String updateTime = "";

  UserData();

  factory UserData.fromJson(Map<String, dynamic> json) => $UserDataFromJson(json);

  Map<String, dynamic> toJson() => $UserDataToJson(this);

  Future<bool> save() async {
    return UserHelp.setUserData(this);
  }
}

@JsonSerializable()
class UserInfoData {
  String id = "";
  String age = "";
  int gender = 0;
  String headImg = "";
  int height = 0;
  String userName = "";
  String nickname = "";
  int weight = 0;
  String qrCode = "";

  UserInfoData();

  factory UserInfoData.fromJson(Map<String, dynamic> json) => $UserInfoDataFromJson(json);

  Map<String, dynamic> toJson() => $UserInfoDataToJson(this);
}
